<?php
	$kode = (int) $_GET['id'];
	ob_start();
	((is_numeric($kode)) && ($kode!=0)) ? $cekKode = "AND idx='".$kode."'" : $cekKode = "";
	define('ABS_URL',str_replace("\\","/",getcwd()));
	require ABS_URL.'/engine/Smarty.class.php';
	require ABS_URL."/functions/class.query.inc.php";
	$smarty = new Smarty();
	require ABS_URL."/dev_con.inc.php";
	require ABS_URL."/functions/func_file.php";
	$queryData = new queryData();
	$queryData->baseConfig();
	require ABS_URL."/functions/func_content.php";
	require ABS_URL."/langs/".BASE_LANGUAGE.'.inc.php';
	header("Content-Type: application/rss+xml");
	$now = date("D, d M Y H:i:s +0000");
	$row = $queryData->selek1("tbl_content","idx='2'");
	echo "<?xml version=\"1.0\"?>\n";
	echo "<rss version=\"2.0\" xmlns:atom=\"http://www.w3.org/2005/Atom\">\n";
	echo "<channel>\n";
	echo "<atom:link href=\"http://".$_SERVER['HTTP_HOST']."/rss.php\" rel=\"self\" type=\"application/rss+xml\" />\n";
	echo "<title>".$row->judul."</title>\n";
	echo "<description>aidiCMS (berdasarkan pada versi 1.0 Open Source aidiCMS di code.google.com)</description>\n";
	echo "<link>http://".$_SERVER['HTTP_HOST']."/index.php/1/detail/".$row->idx."/</link>\n";
	echo "<language>en-us</language>\n";
	echo "<pubDate>".$now."</pubDate>\n";
	echo "<lastBuildDate>".$now."</lastBuildDate>\n";
	echo "<docs>http://".$_SERVER['HTTP_HOST']."</docs>\n";
	echo "<managingEditor>".AUTHOR_MAIL." (".AUTHOR_MAIL_NAME.")</managingEditor>\n";
	echo "<webMaster>".AUTHOR_MAIL." (".AUTHOR_MAIL_NAME.")</webMaster>\n";
	$sql1 = "SELECT * FROM tbl_content WHERE status='1' ".$cekKode." ORDER BY tanggal DESC LIMIT ".PAGE;
	$qry1 = mysql_query($sql1);
	while ($row1 = mysql_fetch_object($qry1)) {
		if (($row1->tipe=='berita') || ($row1->tipe=='artikel'))
			$tipedata = 'detail';
		else
			$tipedata = 'dinamis';
		echo "<item>\n";
		echo "<title>".$row1->judul."</title>\n";
		echo "<description>".htmlspecialchars($row1->isi)."</description>\n";
		echo "<link>http://".$_SERVER['HTTP_HOST']."/index.php/1/".$tipedata."/".$row1->idx."/".$queryData->permalink($row1->idx)."/</link>\n";
		echo "<guid>http://".$_SERVER['HTTP_HOST']."/index.php/1/".$tipedata."/".$row1->idx."/".$queryData->permalink($row1->idx)."/</guid>\n";
		echo "</item>\n";
	}
	echo "</channel>\n";
	echo "</rss>\n";
	$html = ob_get_contents();
	ob_end_clean();
	if (strip_tags($_GET['show'])!="admin") {
		if (defined('USE_REWRITE')) {
			$html = str_replace("index.php",USE_REWRITE,$html);
		}
	} 
	echo $html;
?>